from django.db import models
from django.contrib.auth.models import User


class Subject(models.Model):
    name = models.CharField(max_length=50)
    text = models.TextField(default="", blank=True)
    color = models.TextField(default="white", blank=True)
    createdBy = models.ForeignKey(User)
    createdOn = models.DateTimeField(auto_now_add=True)

class Problem(models.Model):
    name = models.CharField(max_length=200)
    createdBy = models.ForeignKey(User)
    createdOn = models.DateTimeField(auto_now_add=True)
    subject = models.ForeignKey(Subject)

class ProblemText(models.Model):
    problem = models.ForeignKey(Problem)
    text = models.TextField(default="", blank=True)
    createdBy = models.ForeignKey(User)
    createdOn = models.DateTimeField(auto_now_add=True)
    #previousText = models.ForeignKey('self', null=True, blank=True)

class SolutionCase(models.Model):
    name = models.CharField(max_length=200)
    createdBy = models.ForeignKey(User)
    createdOn = models.DateTimeField(auto_now_add=True)
    problem = models.ForeignKey(Problem)

class SolutionCaseText(models.Model):
    solutionCase = models.ForeignKey(SolutionCase)
    text = models.TextField(default="", blank=True)
    createdBy = models.ForeignKey(User)
    createdOn = models.DateTimeField(auto_now_add=True)
    #previousText = models.ForeignKey('self', null=True, blank=True)

class SolutionLanguage(models.Model):
    solutionCase = models.ForeignKey(SolutionCase)
    text = models.TextField(default="", blank=True)
    createdBy = models.ForeignKey(User)
    createdOn = models.DateTimeField(auto_now_add=True)
    #previousText = models.ForeignKey('self', null=True, blank=True)

class SolutionCaseProof(models.Model):
    name = models.CharField(max_length=200)
    text = models.TextField(default="", blank=True)
    createdBy = models.ForeignKey(User)
    createdOn = models.DateTimeField(auto_now_add=True)
    solution_case = models.ForeignKey(SolutionCase)

# Create your models here.
